package Achieve

import (
	"../ProtoGo"
	"../Robot"
	"github.com/golang/protobuf/proto"
)

var command = Cmd.Command_SCENE_USER_ACHIEVE_PROTOCMD.Enum()

func RegisterAchieveHandler(r *Robot.Robot) {
	r.RobotLog("注册成就模块")

	pp := Cmd.AchieveParam_ACHIEVEPARAM_QUERY_ACHDATA.Enum()
	r.Handler.RegisterHandle(byte(*command), byte(*pp), handleQueryAchieveDataAchCmd)
}

func handleQueryAchieveDataAchCmd(xcmd *Robot.XCommand, robot *Robot.Robot) {
	response := &Cmd.QueryAchieveDataAchCmd{}
	if err := proto.Unmarshal(xcmd.Probuf, response); err != nil {
		robot.RobotErr("序列化QueryAchieveDataAchCmd")
	} else {
		robot.RobotLog("接收协议QueryAchieveDataAchCmd %s ", response.String())
	}
}
